package com.jckl.foodathon.sqlite.services;

import java.util.List;

import com.jckl.foodathon.sqlite.dao.DaoSession;
import com.jckl.foodathon.sqlite.dao.TB_BloggerDao;
import com.jckl.foodathon.sqlite.model.TB_Blogger;


public class BloggerRepository {
	
	private static TB_BloggerDao getBloggerDao(DaoSession session) {
		return session.getTB_BloggerDao();
    }
	
	public static void insertOrUpdate(DaoSession session, TB_Blogger blogger){
		getBloggerDao(session).insertOrReplace(blogger);
	}
	
	public static TB_Blogger getBloggerForId(DaoSession session, long id){
		return getBloggerDao(session).load(id);
	}
	
	public static List<TB_Blogger> getAllBloggers(DaoSession session){
		return getBloggerDao(session).loadAll();
	}
	
	public static void clearBloggers(DaoSession session){
		getBloggerDao(session).deleteAll();
	}
	
	public static void deleteBloggerWithId(DaoSession session, long id){
		getBloggerDao(session).delete(getBloggerForId(session, id));
	}

}
